using System;

namespace Microsoft.PowerShell.CmdletManagement
{
    /// <summary>
    /// A class that represents a Cmdlet Parameter
    /// </summary>
    public class PsSpecCmdletParameter : ICloneable, IEquatable<PsSpecCmdletParameter>
    {
        public PsSpecCmdletParameter() { }

        public PsSpecCmdletParameter(int id, string projectName, string cmdletName, string parameterName, 
            string type, string description, string[] alias,
            bool allowGlobbing, bool allowMultiple,
            bool isDynamic, bool allowEmptyCollection, bool allowEmptyString, bool allowNull,
            int[] validateCount, bool validateNotNull, bool validateNotNullOrEmpty, 
            int[] validateRange, string[] validateSet, int[] validateLength, string validatePattern,
            string note, string defaultValue, string custom1, string custom2,
            string custom3, string custom4, string helpDescription)
        {
            this.id = id;
            this.projectName = projectName;
            this.cmdletName = cmdletName;
            this.parameterName = parameterName;
            this.type = type;
            this.description = description;
            this.alias = alias;
            this.allowGlobbing = allowGlobbing;
            this.allowMultiple = allowMultiple;
            this.isDynamic = isDynamic;
            this.allowEmptyCollection = allowEmptyCollection;
            this.allowEmptyString = allowEmptyString;
            this.allowNull = allowNull;
            this.validateCount = validateCount;
            this.validateNotNull = validateNotNull;
            this.validateNotNullOrEmpty = validateNotNullOrEmpty;
            this.validateRange = validateRange;
            this.validateSet = validateSet;
            this.validateLength = validateLength;
            this.validatePattern = validatePattern;
            this.notes = note;
            this.defaultValue = defaultValue;
            this.custom1 = custom1;
            this.custom2 = custom2;
            this.custom3 = custom3;
            this.custom4 = custom4;
            this.helpDescription = helpDescription;
        }

        public int Id
        {
            get { return id; }
            set { id = value; }
        }
        private int id;

        public string ProjectName
        {
            get { return projectName; }
            set { projectName = value; }
        }
        private string projectName = null;

        public string CmdletName
        {
            get { return cmdletName; }
            set { cmdletName = value; }
        }
        private string cmdletName = null;

        public string Name
        {
            get { return parameterName; }
            set { parameterName = value; }
        }
        private string parameterName = null;

        public string Type
        {
            get { return type; }
            set { type = value; }
        }
        private string type = null;

        public string Description
        {
            get 
            {
                if (String.IsNullOrEmpty(description)) return null;
                else return description; 
            }
            set { description = value; }
        }
        private string description = null;

        public String HelpDescription
        {
            get { return helpDescription; }
            set { helpDescription = value; }
        }
        private string helpDescription;

        public String DefaultValue
        {
            get { return defaultValue; }
            set { defaultValue = value; }
        }
        private string defaultValue;

        public string[] Alias
        {
            get { return alias; }
            set { alias = value; }
        }
        private string[] alias = null;

        public bool AllowGlobbing
        {
            get 
            {
                return allowGlobbing; 
            }
            set 
            {
                allowGlobbing = value;
            }
        }
        private bool allowGlobbing;

        public bool AllowMultiple
        {
            get
            {
                return allowMultiple;
            }
            set
            {
                allowMultiple = value;
            }
        }
        private bool allowMultiple;

        public bool AllowEmptyCollection
        {
            get
            {
                return allowEmptyCollection;
            }
            set
            {
                allowEmptyCollection = value;
            }
        }
        private bool allowEmptyCollection;

        public bool AllowEmptyString
        {
            get
            {
                return allowEmptyString;
            }
            set
            {
                allowEmptyString = value;
            }
        }
        private bool allowEmptyString;

        public bool AllowNull
        {
            get
            {
                return allowNull;
            }
            set
            {
                allowNull = value;
            }
        }
        private bool allowNull;

        public int[] ValidateCount
        {
            get { return validateCount; }
            set { validateCount = value; }
        }
        private int[] validateCount = null;

        public bool ValidateNotNull
        {
            get
            {
                return validateNotNull;
            }
            set
            {
                validateNotNull = value;
            }
        }
        private bool validateNotNull;

        public bool ValidateNotNullOrEmpty
        {
            get
            {
                return validateNotNullOrEmpty;
            }
            set
            {
                validateNotNullOrEmpty = value;
            }
        }
        private bool validateNotNullOrEmpty;

        public int[] ValidateRange
        {
            get { return validateRange; }
            set { validateRange = value; }
        }
        private int[] validateRange = null;

        public string[] ValidateSet
        {
            get { return validateSet; }
            set { validateSet = value; }
        }
        private string[] validateSet = null;

        public int[] ValidateLength
        {
            get { return validateLength; }
            set { validateLength = value; }
        }
        private int[] validateLength = null;

        public string ValidatePattern
        {
            get
            {
                if (String.IsNullOrEmpty(validatePattern)) return null;
                else return validatePattern; 
            }
            set { validatePattern = value; }
        }
        private string validatePattern = null;

        public bool IsDynamic
        {
            get
            {
                return isDynamic;
            }
            set
            {
                isDynamic = value;
            }
        }
        private bool isDynamic;

        public string Notes
        {
            get 
            {
                if (String.IsNullOrEmpty(notes)) return null;
                else return notes; 

            }
            set { notes = value; }
        }
        private string notes = null;

        public String Custom1
        {
            get { return custom1; }
            set { custom1 = value; }
        }
        private string custom1;


        public String Custom2
        {
            get { return custom2; }
            set { custom2 = value; }
        }
        private string custom2;


        public String Custom3
        {
            get { return custom3; }
            set { custom3 = value; }
        }
        private string custom3;


        public String Custom4
        {
            get { return custom4; }
            set { custom4 = value; }
        }
        private string custom4;


        public Object Clone()
        {
            return this.MemberwiseClone();
        }

        #region IEquatable<PsSpecCmdletParameter> Members

        public bool Equals(PsSpecCmdletParameter other)
        {
            if (other == null)
            {
                return false;
            }

            if ((this.Id == other.Id) &&
                (this.ProjectName == other.ProjectName) &&
                (this.CmdletName == other.CmdletName) &&
                (this.Name == other.Name) &&
                (this.Type == other.Type) &&
                (this.Description == other.Description) &&
                (this.Alias == other.Alias) &&
                (this.AllowGlobbing == other.AllowGlobbing) &&
                (this.AllowMultiple == other.AllowMultiple) &&
                (this.IsDynamic == other.IsDynamic) &&
                (this.AllowEmptyCollection == other.AllowEmptyCollection) &&
                (this.AllowEmptyString == other.AllowEmptyString) &&
                (this.AllowNull == other.AllowNull) &&
                (this.ValidateCount == other.ValidateCount) &&
                (this.ValidateNotNull == other.ValidateNotNull) &&
                (this.ValidateNotNullOrEmpty == other.ValidateNotNullOrEmpty) &&
                (this.ValidateRange == other.ValidateRange) &&
                (this.ValidateSet == other.ValidateSet) &&
                (this.ValidateLength == other.ValidateLength) &&
                (this.ValidatePattern == other.ValidatePattern) &&
                (this.Notes == other.Notes) &&
                (this.DefaultValue == other.DefaultValue) &&
                (this.Custom1 == other.Custom1) &&
                (this.Custom2 == other.Custom2) &&
                (this.Custom3 == other.Custom3) &&
                (this.Custom4 == other.Custom4) &&
                (this.HelpDescription == other.HelpDescription))
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        #endregion
    }
}